var WEBGL;
var ANIMATOR;
var ARBOL = null; //objeto 3d que mantiene la representacion de los edificios/floors/spaces y portal (objeto de THREE.js)
var MATERIAL_BUILDER = null;
var GEOMETRY_BUILDER = null;

var meshParedes = [];

var aulas_displonibles = [];//listado de aulas para buscar
var dialogosAbiertos = 0;

//la camara pregunta si hay algun dialog abierto, en cuyo caso, deshabilita el movimiento de la camara
function algunDialogoAbierto(){	return dialogosAbiertos;}

/*--------------------------------------------------------------------------------------------------*/
/*-------------------------------------------- onload! ---------------------------------------------*/
/*--------------------------------------------------------------------------------------------------*/
window.onload = function() {
	
	$("#inputInicio").val(aulaInicio);
	$("#inputDestino").val(aulaDestino);
		
	  MATERIAL_BUILDER = new MaterialBuilder();
	  GEOMETRY_BUILDER = new GeometryBuilder();
	  
	//webgl
	  WEBGL = new  webglObject();
	  WEBGL.init();	
		//creamos mundo a partir de json (dsp de hacer pedido ajax)
	  ARBOL = new Arbol(WEBGL.getScene());//pasamos la escena en la que dibujaremos el arbol
	
	  var callback = function(){
		
		  $("#progreso").css('display','none');
		  
		ARBOL.makeActiveLevel(ARBOL.getNodos()[pisoActual]["niveles"][0], true);
		  WEBGL.startRendering();		  
	  };
	  ARBOL.insertFloorsFromServer(pisosIniciales, primerEdificio, rutaJSONS+primerEdificio, callback);
	  
	  	  
		console.log("__ARBOL__", ARBOL.getNodos());
	  ANIMATOR = new dibujadorCaminos();
	  
	 
	  
		 //busco el listado de aulas (obs: traigo todas y las guardo en una variable)
		 //otra forma mas eficiente (dependiendo de la cantidad de aulas) seria tener un script PHP
		 //que vaya retornando las aulas de acuerdo al pedido (se pide a medida que se van agregando letras)
		 $.ajax({
	            type: "GET",
	            url: rutaNombreAulas,
	            success: function(data){
	            	aulas_displonibles = eval('(' + data + ')');
	                console.log("aulas_displonibles",aulas_displonibles);
	                
	                $("#botonGetCamino").removeClass('ui-state-disabled');
	            	
	            	//verifico si tengo que generar la animacion apenas de carga la pagina
	            	if (animarAlCargar){
	            		animarAlCargar = false;
	            		$("#botonGetCamino").trigger("click");
	            	}
	            	
	            	//AUTOCOMPLETE
	            	$("#inputInicio, #inputDestino").autocomplete({
	            	    source: aulas_displonibles,
	            	    minLength: 1,//2,//TODO
	            	    open: function(){
	            	        $(this).removeClass("ui-corner-all").addClass("ui-corner-top");
	            	    },
	            	    close: function(){
	            	        $(this).removeClass("ui-corner-top").addClass("ui-corner-all");
	            	    }
	            	});
	            }
	        });
	//fin webgl
	
	//------------------------------------------DOCK----------------------------------------------			
		 
		// ================================================================
//       ------ dock menu -------
//script by Gerard Ferrandez - Ge-1-doot - February 2006
//http://www.dhteumeuleu.com
//================================================================


var dock = 	 function (dock, sMin, sMax) {
				/* ---- private vars ---- */
				var xm = xmb = ov = 0;
				var M = true;
				var icons = document.getElementById(dock).getElementsByTagName('img');
				var N = icons.length;
				var s = sMin;
				var ovk = 0;
				var addEvent = function (o, e, f) {
					if (window.addEventListener) o.addEventListener(e, f, false);
					else if (window.attachEvent) r = o.attachEvent('on' + e, f);
				};
				var pxLeft = function(o) {
					for(var x=-document.documentElement.scrollLeft; o != null; o = o.offsetParent) x+=o.offsetLeft;
					return x;
				};
				for(var i=0;i<N;i++) {
					var o = icons[i];
					o.style.width = sMin+"%";
//					o.style.height = sMin+"%";
					o.className = "dockicon";
				}
				var run = function() {
					for(var i=0;i<N;i++) {
						var o = icons[i];
//						var W = parseInt(o.style.width);
						if(ov && ov.className=="dockicon") {
							if(ov!=ovk){
								ovk=ov;
								document.getElementById("legend").innerHTML = ov.lang.replace('_',' ');
							}
//							if(M) W = Math.max((s*Math.cos(((pxLeft(o)+W/2)-xm)/sMax)),sMin);
//							s = Math.min(sMax,s+.5);
						} else {
//							s = Math.max(s-.5,sMin);
//							W = Math.max(W-N,sMin);
						}
//						o.style.width = W+"%";
//						o.style.height = W+"%";
//						o.style.paddingTop = sMax-W +"%";//JEIB
					}
					if(s >= sMax) M = false;
				};
				addEvent(document, 'mousemove', function (e) {
					if(window.event) e=window.event;
					xm = (e.x || e.clientX);
					if(xm!=xmb){
						M = true;
						xmb = xm;
					}
					ov = (e.target)?e.target:((e.srcElement)?e.srcElement:null);
					run();
				});
//				setInterval(run, 16);
			};
		 
		 
	dock("dock", 8, 10);//menu de items header	(OBS: el codigo del dock esta modificado para que no se anime y en porcentajes en vez de px)
//	dock("dock", 86, 128);//menu de items header	
	//--------------------------------------------------------------------------------------------	
	
	//------------------------------------------COOKIES----------------------------------------------
	cargarDatosCookies();
	//------------------------------------------------------------------------------------------------	

	//---------------------------------RESIZE CANVAS PRINCIPAL----------------------------------------
	$("#botonAchicarFlow").hide();
	$("#botonRestaurarFlow").hide();
	//----------------------------------------------------------------------------------------------
	
	
	//---------------------------------BOTON 'HOW TO USE' ----------------------------------------	
	$("#howToUseButton").click(function(event){
		var nodoPregunta = event.target;
		var mensaje = "Checkboxes y radiobuttons para cambiar la configuracion de la vista y las animaciones";
				
		var position = $(nodoPregunta).offset(); 
		   var x = $(nodoPregunta).position().left + $(nodoPregunta).outerWidth();
	    var y = $(nodoPregunta).position().top - $(document).scrollTop();
		
	    domDiagHowToUse = $( "#howToUse");
	    $(domDiagHowToUse).html(mensaje);
		$(domDiagHowToUse).dialog( "option", "position", [x ,y ]);
		$(domDiagHowToUse).dialog( "open" );
	});
	//----------------------------------------------------------------------------------------------
	
	//---------------------------------BOTONES INIT y REINIT animacion ----------------------------------------
	$("#botonInitAnimCamino").click(function(){	ANIMATOR.iniciarAnimacion();});
	$("#playPause").click(function(){	
		if(ANIMATOR.getAnimationState() == "playing"){
//			ANIMATOR.setInterruptSignal("PAUSE");
			ANIMATOR.pauseAnimation();
		
		}else{			
//			ANIMATOR.setInterruptSignal("STOP");
			ANIMATOR.playAnimation();
		}			
	});
	$("#stop").click(function(){ 
		ANIMATOR.stopAnimation();
		//setInterruptSignal("STOP");
	});
	
	$("#playFromSelected").click(function(){ 		
		ANIMATOR.playAnimationFromKey($('select#opcionesCamino option:selected').val());
	});
	
	
	
	$("#openGallery").click(function(){ 	
//		
//		var sel= $('select#opcionesCamino option:selected')[0];
//		console.log("GALERIA opcion seleccionada->",sel);
//		
//		var ind = $(sel).index() -1 ;
//		console.log("indice-------------------->",ind);
//		console.log("indice-------------------->",ind);
//		//ind  = 1;
//		$(".pirobox_gallaulas:nth-child("+ind+")").trigger("click");
	var value = $('select#opcionesCamino option:selected').val();
		$("#imagenGaleria"+value).trigger("click");
		
		
	});
	
	
	//---------------------------------BOTON INICIAR ANIMACION ----------------------------------------
	$("#botonGetCamino").click(function(event){
		
		
		 $("#textareaResultado").css('display','none');
  		 $("#textareaResultado").html('');
  		 ANIMATOR.cleanAnimation();
  		
//  		$("#botonReInitAnimCamino").css('display','none');
  		 
		source = $("#inputInicio").val();
		target = $("#inputDestino").val();
		
//		if (!source || !target){
//			alert("error en el ingreso de los datos. TODO (mejor chequeo)");//TODO
//			return;
//		}
	
		if ($.inArray(source, aulas_displonibles) == -1){
    	alert("ERROR. El campo 'Inicio' no representa un aula válida");//TODO
			return;
		}
		
		if ($.inArray(target, aulas_displonibles) == -1){
		  	alert("ERROR. El campo 'Destino' no representa un aula válida");//TODO
			return;
		}
		
		
		$("#logEsperando").css("display","inline");
//		var fallar = false;
		
		
		//hago el pedido de la ruta al servidor
		 $.ajax({
             type: "GET",
             url: "./wrapper.php?",
             data: {
                 "source": source,
                 "target": target
             },
             //TODO esta funcion meterla en el objeto WEBGL o ARBOL
             success: function(data){
                 var respuesta = eval('(' + data + ')');
   
                 $("#logEsperando").css("display","none");
                 
                 if (respuesta.resultado){
//              	   alert("esto es lo que retorno el pedido: "+respuesta.resultado); 
//		              	 if (!fallar)
		              	 {
		              		$("#textareaResultado").css('display','inline');
		              		$("#textareaResultado").val('Recorrido:\n');
		              		          		
		              		 //primero evaluo si los edificios/pisos que forman el camino, estan cargados 
		              		 //del lado del cliente
		              		res = eval(respuesta.resultado);
		              		pisosFaltantes = {};
		              		for (var i = 0; i< res.length; i++){
		              			var patt = new RegExp('[^\/]*');
		              			
		              			if (res[i].tipo != "plano") continue; //TODO para detectar los de tipo portal
		              			
		              			
		            			var nombreEdificio = res[i].id.match(patt)[0];
		            			var nombrePiso = res[i].id.substring(nombreEdificio.length +1);
		            			var nivel = res[i].level;
//		            			 console.log("*nombreEdificio", nombreEdificio);
//		           			     console.log("*nombrePiso",  nombrePiso );
//		           			     console.log("* !ARBOL[nombreEdificio] || !ARBOL[nombreEdificio][nombrePiso]",(!ARBOL[nombreEdificio] || !ARBOL[nombreEdificio][nombrePiso]));		           			  
//		           			     console.log("*url",(rutaJSONS+nombreEdificio+"/"+nombrePiso+".json"));		           			  
		            			var ultimoNombre = null;
		            			for (var j = 0; j<res[i].puntos.length; j++){
		            				if (res[i].puntos[j].tipo == "escalera") continue;//TODO
		            				if (res[i].puntos[j].nombre && res[i].puntos[j].nombre!=ultimoNombre){
		            				$("#textareaResultado").val($("#textareaResultado").val()+res[i].puntos[j].nombre+" ("+nombrePiso+"@"+nombreEdificio+")\n");
		            				ultimoNombre = res[i].puntos[j].nombre;
		            				}
		            			}
		            			
		            			 
		           			     
		              			if (!ARBOL.getNodos()[nombreEdificio] || !ARBOL.getNodos()[nombreEdificio][nombrePiso]){
		              				
		              				 $.ajax({
		              				     type: "GET",
		              				     async: false,
		              				     url: rutaJSONS+nombreEdificio+"/"+nombrePiso+".json",
		              				     success: function(data){
//		              				    	 console.log("ajax PISOS INCOMPLETOS", data);
//		              				    	 console.log("JSON",data);
		              				    	ARBOL.insertarPisoDesdeArchivo(nombreEdificio, data);
		              				     }
		              				 });
		              				
		              			}
		              		} 
		              		 
		              		
		         			ANIMATOR.crearAnimacion( res, ARBOL);
		         			console.log("_____respuesta.resultado______",eval(respuesta.resultado));
		         			$("#botonInitAnimCamino").removeClass('ui-state-disabled');
		         		}
                 }
                 else{
                	
              	   alert("oops! hubo un error con el pedido al servidor: \n"+respuesta.error);                	    
                 }
             }
         });
	});
	
	//------------------------------------------------------------------------------------------------
	
	
	
	
	
	//**************************************************************************************************
	//------------------------------------------CHECKBOXES----------------------------------------------
	//**************************************************************************************************
	if (WEBGL.getRenderizarContexto()) {$("#chBoxContext").attr('checked', true).css("display","inline"); }
	else {$("#chBoxContext").attr('checked', false).css("display","none"); };
	
	 $("#chBoxContext").change(function() {
		 WEBGL.toggleRenderizarContexto();
		  if ($(this).attr("checked")){ renderizarContexto = true; $(WEBGL.getDomStats()).css("display","inline");}
		  else {renderizarContexto = false;}
	 });
	 
	
	if (statsEnabled) {$("#chBoxStatsBool").attr('checked', true).css("display","inline"); }
	else {$("#chBoxStatsBool").attr('checked', false).css("display","none"); };
	
	 $("#chBoxStatsBool").change(function() {
		  if ($(this).attr("checked")){ statsEnabled = true; $(WEBGL.getDomStats()).css("display","inline");}
		  else {statsEnabled = false;$(WEBGL.getDomStats()).css("display","none");}
	 });
	 
	 
	 
	 if (flechasCaminoEnabled) {$("#chBoxFlechas").attr('checked', true); }
	 else {$("#chBoxFlechas").attr('checked', false); };
	 
	 $("#chBoxFlechas").change(function() {
		 if ($(this).attr("checked")){ flechasCaminoEnabled = true; }
		 else {flechasCaminoEnabled = false;}
	 });
	 
	 
	 if (ANIMATOR.getRotarCamEnEsc()) {$("#chBoxCamaraAnim").attr('checked', true); }
		else {$("#chBoxCamaraAnim").attr('checked', false); };
		
		 $("#chBoxCamaraAnim").change(function() {
			 ANIMATOR.setRotarCamEnEsc($(this).attr("checked"));			  
		 });
		 
	 if (ANIMATOR.getRotarYPitchCamEnAnim()) {$("#chBoxYPCamaraAnim").attr('checked', true); }
	 else {$("#chBoxYPCamaraAnim").attr('checked', false); };
	 
	 $("#chBoxYPCamaraAnim").change(function() {
		 ANIMATOR.setRotarYPitchCamEnAnim($(this).attr("checked"));			  
	 });
	 
	 
	 //---------------------------------------fin CHECKBOXES---------------------------------------------- 
	 

	 
	 
	 
//	 $( "#slider_prueba" ).slider({ values: [1,5,9] });
	 
	 
	 
	 
	 
	 
	 //---------------------RADIO BUTTONS
	 
	 //cargamos los radio buttons segun los tipos de animacion (definidos en dibujadorCamino.js)
	 var arr = ANIMATOR.getTiposAnimacion();
	 for (var i in arr){
		 r1 = $("<input />").attr({type: 'radio', name: 'tipoAnimacion', value: arr[i].tipo});
		texto = arr[i].desc; 
		 $("#divRadiosAnimacion").append(r1);
		 $("#divRadiosAnimacion").append(texto);
		 $("#divRadiosAnimacion").append("<br>");
	 }	 
	 
	 //chequeamos el tipo de animacion
	//$('input:radio[name=tipoAnimacion]:nth(0)').attr('checked',true); TODO es poco flexible
	
	//seleccionamos el radio button del tipo de animacion, segun el valor de la configuracion inicial
	$('input:radio[name=tipoAnimacion][value='+_TIPO_ANIMACION_INICIAL+']:nth(0)').attr('checked',true);
	
	
	$("input[name=tipoAnimacion]").change(function(){
//		alert($("input[name=tipoAnimacion]:checked").val());
		ANIMATOR.setTipoAnimacion($("input[name=tipoAnimacion]:checked").val());	  
	});
	
	////-----------
	
	$("#divRadiosAnimacionCamara").append("<br>");
	 var arr = ANIMATOR.getTiposAnimacionCamara();
	 var textoBotones = "Actualizar"; // esto hasta que se agregue el evento para hacer enter
	 for (var i in arr){
		 span = $("<div>");
		 r1 = $("<input />").attr({type: 'radio', name: 'tipoAnimacionCamara', value: arr[i].tipo});
		texto = arr[i].desc;
		
		 $(span).append(r1);
		 $(span).append(texto);
		
		var otrosComponetes = null;
		
		//TODO aca agregar los inputs para la animacion
		switch(arr[i].tipo){
			case "CONSTANTE" :
				
				otrosComponetes = $("<div>");
				 $(span).append(otrosComponetes);
				otrosComponetes.css("margin-left","20px");
				
				
				otrosComponetes.append("Tiempo en Seg");
				
				
				span2 = $("<div>").appendTo(otrosComponetes);
				span2.addClass("ui-spinner");
				
				 $("<input />").attr({ type: 'text', id: 'inputCameraAnimation',value: _TIEMPO_POSICIONAMIENTO_CAMARA/1000,	size: 6 ,/*readonly: true*/})
				 .addClass("ui-spinner-box")
				.appendTo(span2)
				 .keyup(function(event){ //capturamos el "enter"
					  if(event.keyCode == 13){
						  if ( isNaN($("#inputCameraAnimation").val())){
						  alert($("#inputCameraAnimation").val()+ " no es un valor valido. recuerde que es el valor en ms");
						  return
					  }
					 ANIMATOR.setTiempoPosCamara($("#inputCameraAnimation").val()*1000);
					  }
					});
				
								 
				 
				 $("<input />").attr({ type: 'button', value: '^'})
					.click(function(){ 	$("#inputCameraAnimation").val(ANIMATOR.addTiempoPosCamara(1000)/1000); })
					.addClass("ui-spinner-up")
					.appendTo(span2);	
								 
				 
				 
				 $("<input />").attr({ type: 'button', value: 'v', })
				 .click(function(){  $("#inputCameraAnimation").val(ANIMATOR.addTiempoPosCamara(-1000)/1000); })
				 .addClass("ui-spinner-down")
				  .appendTo(span2);
				 ;
				  
				  
//				  $("<input />").attr({ type: 'button', value: textoBotones, })
//				  .click(function(){
//					  if ( isNaN($("#inputCameraAnimation").val())){
//						  alert($("#inputCameraAnimation").val()+ " no es un valor valido. recuerde que es el valor en ms");
//						  return
//					  }
//					 ANIMATOR.setTiempoPosCamara($("#inputCameraAnimation").val()*1000);				  
//				   })
//				 .appendTo(otrosComponetes);
				 		
				break;
				
				
			case "VARIABLE" : 
				
				
				otrosComponetes = $("<div>").appendTo(span);
				otrosComponetes.css("margin-left","20px");
				
				otrosComponetes.append("Unidades por Segundo");
				
				
				span2 = $("<div >").appendTo(otrosComponetes);
				span2.addClass("ui-spinner");
				
				 $("<input />").attr({ type: 'text', id: 'inputVelocidadCamara',value: _VELOCIDAD_POSICIONAMIENTO_CAMARA*1000,	size: 6 ,/*readonly: true*/})
				 .addClass("ui-spinner-box")
				.appendTo(span2)
				 .keyup(function(event){ //capturamos el "enter"
					  if(event.keyCode == 13){
						  if ( isNaN($("#inputVelocidadCamara").val())){
							  alert($("#inputVelocidadCamara").val()+ " no es un valor valido. recuerde que es el valor en ms");
							  return
						  }
						 ANIMATOR.setVelReposCamara($("#inputVelocidadCamara").val()/1000);	
					  }
					});
				
				
								 
				 
				 $("<input />").attr({ type: 'button', value: '^'})
					.click(function(){ 	$("#inputVelocidadCamara").val(ANIMATOR.addVelReposCamara(100)*1000); })
					.addClass("ui-spinner-up")
					.appendTo(span2);	
								 
				 
				 
				 $("<input />").attr({ type: 'button', value: 'v', })
				 .click(function(){  $("#inputVelocidadCamara").val(ANIMATOR.addVelReposCamara(-100)*1000); })
				 .addClass("ui-spinner-down")
				  .appendTo(span2);
				 ;
				  
				

//				  $("<input />").attr({ type: 'button', value: textoBotones, })
//				  .click(function(){
//					  if ( isNaN($("#inputVelocidadCamara").val())){
//						  alert($("#inputVelocidadCamara").val()+ " no es un valor valido. recuerde que es el valor en ms");
//						  return
//					  }
//					 ANIMATOR.setVelReposCamara($("#inputVelocidadCamara").val()/1000);				  
//				   })
//				 .appendTo(otrosComponetes)				
//				 ;
				
				
				
				
				
				
				break;
		
		}
	
		 $("#divRadiosAnimacionCamara").append(span);
		 if (otrosComponetes)  $("#divRadiosAnimacionCamara").append(otrosComponetes);
		 $("#divRadiosAnimacionCamara").append("<br>");
	 }	 
	
	//seleccionamos el radio button del tipo de animacion, segun el valor de la configuracion inicial
	$('input:radio[name=tipoAnimacionCamara][value='+_TIPO_ANIMACION_CAMARA_INICIAL+']:nth(0)').attr('checked',true);
	
	$("input[name=tipoAnimacionCamara]").change(function(){
		
//		alert($("input[name=tipoAnimacion]:checked").val());
		ANIMATOR.setTipoAnimacionCamara($("input[name=tipoAnimacionCamara]:checked").val());	
		console.log("ANIMATOR.getTiposAnimacionCamara()",ANIMATOR.getTiposAnimacionCamaraActivo());
		//alert(ANIMATOR.getTiposAnimacionCamaraActivo());
	});
	
	
	//----------------
	
	
	 
	//--------------------------------------SLIDER VELOCIDAD ANIMACION----------------------------------------------
	 $( "#sliderVelocidadAnimacion" ).slider({
			value: 10,
			min: 1,
			max: 300,
			step: 5,
			slide: function( event, ui ) {
				$( "#velocidadAnimacion" ).html(ui.value );
				ANIMATOR.setVelAnimUnidadesxSeg(ui.value);
			}
		});
		$( "#velocidadAnimacion" ).html(10);
		
		
		$( "#sliderDuracionAnimacion" ).slider({range: "min"});
		$( "#sliderDuracionAnimacion" ).slider( "option", "disabled", true );
		$( "#duracionAnimacion" ).html('?');
		
		console.log("_________slider",$( "#sliderVelocidadAnimacion" ).slider( "widget" ));
	//------------------------------------------------------------------------------------------------

//**************************************************************************************************
//----------------------------------------DIALOGOS----------------------------------------------
//**************************************************************************************************

$('<div>').attr("id","aboutus").attr("class","dialog-modal").attr("title","Comision").appendTo($(document.body));
$('<div>').attr("id","error").attr("class","dialog-modal").attr("title","Error").appendTo($(document.body));
$('<div>').attr("id","howToUse").attr("class","dialog-modal").attr("title","Como se usa").appendTo($(document.body));

	
	
	$( "#aboutus" ).dialog({
		modal: true,
		autoOpen: false,	
		buttons: {	Ok: function() {$( this ).dialog( "close" );}},
		close: function(event, ui) {dialogosAbiertos--; },
		open: function(event, ui) {dialogosAbiertos++; },
	});
	
	
	$( "#error" ).dialog({	
		modal: true,
		autoOpen: false,	
		buttons: {	Ok: function() {$( this ).dialog( "close" );}},
		close: function(event, ui) {dialogosAbiertos--; },
		open: function(event, ui) {dialogosAbiertos++; },
	});
	
	$( "#howToUse" ).dialog({	
		modal: true,
		autoOpen: false,	
		buttons: {	Ok: function() {$( this ).dialog( "close" );}},
		close: function(event, ui) {dialogosAbiertos--; },
		open: function(event, ui) {dialogosAbiertos++; },
	});
		
	//---------------------------------------- fin DIALOGOS----------------------------------------------	
	
	
};




/*--------------------------------------------------------------------------------------------------*/
/*--------------------------------------- cargar cookies al iniciar --------------------------------*/
/*--------------------------------------------------------------------------------------------------*/
//carga los elementos individuales que haya en la cookie

function cargarDatosCookies() {
	
		
	var estilo = getCookie("estilo");
	
	$(".subContenidoSI").each(function(index){$(this).addClass("subContenidoSI_fondoOscuro");});
	
	if (estilo) {
		var cssRef = document.getElementById("cssRef");
		var imagenLogo = document.getElementById("logo");
		if (estilo == "1") {
			cssRef.setAttribute("href",
				"css/dark-hive/jquery-ui-1.8.11.custom.css");
		imagenLogo.setAttribute("src", "./imagenes/dock/"+nombreImagenLogo);
		$(".subContenidoSI").each(function(index){$(this).addClass("subContenidoSI_fondoOscuro");});
		}
		
		else {
			cssRef.setAttribute("href","css/ui-lightness/jquery-ui-1.8.11.custom.css");
			imagenLogo.setAttribute("src", "./imagenes/dock/"+nombreImagenLogo);
			$(".subContenidoSI").each(function(index){$(this).removeClass("subContenidoSI_fondoOscuro");});
		}
	}

}




/*##################################################################################################*/
/*---------------------------------------------- ESTILOS -----------------------------------------*/
/*##################################################################################################*/

/*--------------------------------------------------------------------------------------------------*/
/*--------------------------------------- cambiar estilo --------------------------------------------*/
/*--------------------------------------------------------------------------------------------------*/
function cambiarEstilo() {

	var cssRef = document.getElementById("cssRef");
	var imagenLogo = document.getElementById("logo");
	if (cssRef.getAttribute("href") == "css/dark-hive/jquery-ui-1.8.11.custom.css") {
		cssRef.setAttribute("href",	"css/ui-lightness/jquery-ui-1.8.11.custom.css");
		imagenLogo.setAttribute("src", "./imagenes/dock/"+nombreImagenLogo);
		$(".subContenidoSI").each(function(index){$(this).removeClass("subContenidoSI_fondoOscuro");})
		setCookie("estilo", "2", 2);
		
	} else {
		cssRef.setAttribute("href",
				"css/dark-hive/jquery-ui-1.8.11.custom.css");
		imagenLogo.setAttribute("src", "./imagenes/dock/"+nombreImagenLogo);
		setCookie("estilo", "1", 2);
		$(".subContenidoSI").each(function(index){$(this).addClass("subContenidoSI_fondoOscuro");});
		
	}
}



/*##################################################################################################*/
/*---------------------------------------------- DIALOGOS -----------------------------------------*/
/*##################################################################################################*/

/*--------------------------------------------------------------------------------------------------*/
/*------------------------------ muestra los integrantes de la comision ----------------------------*/
/*--------------------------------------------------------------------------------------------------*/
function aboutus(){
	document.getElementById('aboutus').innerHTML = '<p>Comision:<p><li>COTRONEO, Alejandro Andres. LU: 74523</li><li>IBANEZ BONDZIO, Jesus Emanuel. LU: 85166</li>';
	$('#aboutus').dialog('open');
	
}

function errorDialog(strError){
	document.getElementById('error').innerHTML = strError;
	$('#error').dialog('open');
	
}



//filtro es un string que indica de que filtro vamos a mostrar cómo se usa
function howToUse(event){
	var nodo = document.getElementById('howToUse');
	var nodoPregunta = event.originalTarget;
	var mensaje = "anita lava la tina";
				
	nodo.innerHTML = mensaje;
	var position = $(nodoPregunta).offset(); 
	var x = $(nodoPregunta).position().left + $(nodoPregunta).outerWidth();
    var y = $(nodoPregunta).position().top - $(document).scrollTop();
	
	$( "#howToUse").dialog( "option", "position", [x ,y ]);
	$( "#howToUse" ).dialog( "open" );
}

/*##################################################################################################*/
/*-------------------------------------- RESIZE WEBGL --------------------------------*/
/*##################################################################################################*/
function agrandarFlow(){
$('#botonAgrandarFlow').hide();
            	 $('#botonAchicarFlow').show();
            	 $('#sidebar1').hide();
            	 $('#sidebar2').hide();
            	 
            	 $('#mainContent').css('width','98%');
            	 $('#mainContent').css('margin','0 0 0 15px');
            	 $('#imageFlow').css('width','100%');
            //	 imf.resize();
	
}
function achicarFlow(){
	 $('#botonAgrandarFlow').show();
            	 $('#botonAchicarFlow').hide();
            	  $('#mainContent').css('width','60%');
            	 $('#mainContent').css('margin','0 20% 0 20%');
            	 $('#imageFlow').css('width','90%');
				$('#sidebar1').fadeIn();
            	 $('#sidebar2').fadeIn();
            	// imf.resize();
}

 function maximizarFlow(){
	
	 
	 $('#botonMaximizarFlow').hide();
	 $('#botonRestaurarFlow').show();
	 $('#sidebar1').hide();
	 $('#sidebar2').hide();
	 $('#header').hide();
	 $('#footer').hide();
	 
	 $('#sidebarsMainContent').css('height','100%');
	 
	 $('html').css('height','100%');
	 $('body').css('height','100%');
	 $('#container').css('height','100%');
	 
	 $('#mainContent').css('width','100%');
	 $('#mainContent').css('height','100%');
	 $('#mainContent').css('margin','0');
	 
	 $('#contenedorCanvas').css('width','100%');
	 $('#contenedorCanvas').css('height','100%');
	 $('#contenedorCanvas').css('margin','0');
	 $('#contenedorCanvas').removeClass('contenedor_screen');
	 $('#clearfloatBR').html('');
	 
	 $('#imageFlow').css('width','100%');
	 $('#imageFlow').css('height','100%');
	 $('#imageFlow').css('margin','0');
	 $('#imageFlow').removeClass('ui-widget-content ui-corner-all');
//	 imf.resize();
	 
	 $('#canvas_webgl').resize();//disparo evento para que se actualice el canvas de webgl
	 $(".clearfloat").hide();
 }
 
 function restaurarFlow(){
	 $('#botonMaximizarFlow').show();
	 $('#botonRestaurarFlow').hide();
	
	 $('#imageFlow').removeAttr("style");
	 $('#imageFlow').addClass('ui-widget-content ui-corner-all');
	 
	 $('#contenedorCanvas').css('width','auto');
	 $('#contenedorCanvas').css('height','none');
	 $('#contenedorCanvas').removeAttr("style");
	 $('#contenedorCanvas').addClass('contenedor_screen');
	 
	$(".clearfloat").show();

	 
	 $('#mainContent').css('width','60%');
//	 $('#mainContent').css('height','auto');
	 $('#mainContent').css('margin','0 20% 0 20%');
	 
	 $('#container').css('height','none');
	 $('body').css('height','none');
	 $('html').css('height','none');
	 
	 $('#clearfloatBR').html('<br class="clearfloat" />');
	 
	 $('#sidebar1').fadeIn();
	 $('#sidebar2').fadeIn();
	 $('#header').fadeIn();
	 $('#footer').fadeIn();
//	 imf.resize();
	 $('#canvas_webgl').resize();//disparo evento para que se actualice el canvas de webgl
	 
	 $('#sidebarsMainContent').css('height','75%');
}





var flechaData = {
	    "version" : 2,

	    "scale" : 1.000000,

	    "materials": [	{
		"DbgColor" : 15658734,
		"DbgIndex" : 0,
		"DbgName" : "wire_176026026",
		"colorAmbient" : [0.6902, 0.102, 0.102],
		"colorDiffuse" : [0.6902, 0.102, 0.102],
		"colorSpecular" : [0.35, 0.35, 0.35],
		"illumination" : 2,
		"specularCoef" : 32.0,
		"transparency" : 0.0
		}],

	    "vertices": [0.000000,36.500300,-0.000000,19.280500,36.500300,11.131600,21.504600,36.500300,5.762100,22.263200,36.500300,-0.000000,11.131600,36.500300,19.280500,15.742500,36.500300,15.742500,0.000000,36.500300,22.263200,5.762200,36.500300,21.504600,-11.131600,36.500300,19.280500,-5.762100,36.500300,21.504600,-19.280500,36.500300,11.131600,-15.742500,36.500300,15.742500,-22.263200,36.500300,0.000000,-21.504600,36.500300,5.762200,-19.280500,36.500300,-11.131600,-21.504600,36.500300,-5.762100,-11.131600,36.500300,-19.280500,-15.742500,36.500300,-15.742500,-0.000000,36.500300,-22.263200,-5.762200,36.500300,-21.504600,11.131600,36.500300,-19.280500,5.762100,36.500300,-21.504700,19.280500,36.500300,-11.131600,15.742500,36.500300,-15.742500,21.504600,36.500300,-5.762200,17.203700,29.200300,4.609700,17.810600,29.200300,-0.000000,15.424400,29.200300,8.905300,12.594000,29.200300,12.594000,8.905300,29.200300,15.424400,4.609700,29.200300,17.203700,0.000000,29.200300,17.810600,-4.609700,29.200300,17.203700,-8.905300,29.200300,15.424400,-12.594000,29.200300,12.594000,-15.424400,29.200300,8.905300,-17.203700,29.200300,4.609700,-17.810600,29.200300,0.000000,-17.203700,29.200300,-4.609700,-15.424400,29.200300,-8.905300,-12.594000,29.200300,-12.594000,-8.905300,29.200300,-15.424400,-4.609700,29.200300,-17.203700,-0.000000,29.200300,-17.810600,4.609700,29.200300,-17.203700,8.905300,29.200300,-15.424400,12.594000,29.200300,-12.594000,15.424400,29.200300,-8.905300,17.203700,29.200300,-4.609700,12.902800,21.900300,3.457300,13.357900,21.900300,-0.000000,11.568300,21.900300,6.679000,9.445500,21.900300,9.445500,6.679000,21.900300,11.568300,3.457300,21.900300,12.902800,0.000000,21.900300,13.357900,-3.457300,21.900300,12.902800,-6.679000,21.900300,11.568300,-9.445500,21.900300,9.445500,-11.568300,21.900300,6.679000,-12.902800,21.900300,3.457300,-13.357900,21.900300,-0.000000,-12.902800,21.900300,-3.457300,-11.568300,21.900300,-6.679000,-9.445500,21.900300,-9.445500,-6.679000,21.900300,-11.568300,-3.457300,21.900300,-12.902800,-0.000000,21.900300,-13.358000,3.457300,21.900300,-12.902800,6.679000,21.900300,-11.568300,9.445500,21.900300,-9.445500,11.568300,21.900300,-6.679000,12.902800,21.900300,-3.457300,8.601900,14.600300,2.304900,8.905300,14.600300,-0.000000,7.712200,14.600300,4.452600,6.297000,14.600300,6.297000,4.452600,14.600300,7.712200,2.304900,14.600300,8.601900,0.000000,14.600300,8.905300,-2.304900,14.600300,8.601900,-4.452600,14.600300,7.712200,-6.297000,14.600300,6.297000,-7.712200,14.600300,4.452600,-8.601900,14.600300,2.304900,-8.905300,14.600300,-0.000000,-8.601900,14.600300,-2.304900,-7.712200,14.600300,-4.452700,-6.297000,14.600300,-6.297000,-4.452700,14.600300,-7.712200,-2.304900,14.600300,-8.601900,-0.000000,14.600300,-8.905300,2.304900,14.600300,-8.601900,4.452600,14.600300,-7.712200,6.297000,14.600300,-6.297000,7.712200,14.600300,-4.452700,8.601900,14.600300,-2.304900,4.300900,7.300300,1.152400,4.452600,7.300300,-0.000000,3.856100,7.300300,2.226300,3.148500,7.300300,3.148500,2.226300,7.300300,3.856100,1.152400,7.300300,4.300900,0.000000,7.300300,4.452600,-1.152400,7.300300,4.300900,-2.226300,7.300300,3.856100,-3.148500,7.300300,3.148500,-3.856100,7.300300,2.226300,-4.300900,7.300300,1.152400,-4.452600,7.300300,-0.000000,-4.300900,7.300300,-1.152400,-3.856100,7.300300,-2.226300,-3.148500,7.300300,-3.148500,-2.226300,7.300300,-3.856100,-1.152400,7.300300,-4.300900,-0.000000,7.300300,-4.452700,1.152400,7.300300,-4.300900,2.226300,7.300300,-3.856100,3.148500,7.300300,-3.148500,3.856100,7.300300,-2.226300,4.300900,7.300300,-1.152400,0.000000,0.000300,-0.000000,0.000000,80.699000,-0.000000,7.267900,80.699000,6.098500,8.915400,80.699000,3.244900,9.487500,80.699000,-0.000000,1.647500,80.699000,9.343400,4.743800,80.699000,8.216500,-4.743800,80.699000,8.216500,-1.647500,80.699000,9.343400,-8.915400,80.699000,3.244900,-7.267900,80.699000,6.098500,-8.915400,80.699000,-3.244900,-9.487500,80.699000,0.000000,-4.743800,80.699000,-8.216400,-7.267900,80.699000,-6.098500,1.647500,80.699000,-9.343400,-1.647500,80.699000,-9.343400,7.267900,80.699000,-6.098500,4.743800,80.699000,-8.216500,8.915400,80.699000,-3.244900,8.915400,71.873700,3.244900,9.487500,71.873700,-0.000000,7.267900,71.873700,6.098500,4.743800,71.873700,8.216500,1.647500,71.873700,9.343400,-1.647500,71.873700,9.343400,-4.743800,71.873700,8.216500,-7.267900,71.873700,6.098500,-8.915400,71.873700,3.244900,-9.487500,71.873700,0.000000,-8.915400,71.873700,-3.244900,-7.267900,71.873700,-6.098500,-4.743800,71.873700,-8.216500,-1.647500,71.873700,-9.343400,1.647500,71.873700,-9.343400,4.743800,71.873700,-8.216500,7.267900,71.873700,-6.098500,8.915400,71.873700,-3.244900,8.915400,63.048300,3.244900,9.487500,63.048300,-0.000000,7.267900,63.048300,6.098500,4.743800,63.048300,8.216400,1.647500,63.048300,9.343400,-1.647500,63.048300,9.343400,-4.743800,63.048300,8.216400,-7.267900,63.048300,6.098500,-8.915400,63.048300,3.244900,-9.487500,63.048300,-0.000000,-8.915400,63.048300,-3.244900,-7.267900,63.048300,-6.098500,-4.743800,63.048300,-8.216500,-1.647500,63.048300,-9.343400,1.647500,63.048300,-9.343400,4.743800,63.048300,-8.216500,7.267900,63.048300,-6.098500,8.915400,63.048300,-3.244900,8.915400,54.223000,3.244900,9.487500,54.223000,-0.000000,7.267900,54.223000,6.098500,4.743800,54.223000,8.216400,1.647500,54.223000,9.343400,-1.647500,54.223000,9.343400,-4.743800,54.223000,8.216400,-7.267900,54.223000,6.098500,-8.915400,54.223000,3.244900,-9.487500,54.223000,-0.000000,-8.915400,54.223000,-3.244900,-7.267900,54.223000,-6.098500,-4.743800,54.223000,-8.216500,-1.647500,54.223000,-9.343400,1.647500,54.223000,-9.343400,4.743800,54.223000,-8.216500,7.267900,54.223000,-6.098500,8.915400,54.223000,-3.244900,8.915400,45.397700,3.244900,9.487500,45.397700,-0.000000,7.267900,45.397700,6.098500,4.743800,45.397700,8.216400,1.647500,45.397700,9.343400,-1.647500,45.397700,9.343400,-4.743800,45.397700,8.216400,-7.267900,45.397700,6.098500,-8.915400,45.397700,3.244900,-9.487500,45.397700,-0.000000,-8.915400,45.397700,-3.244900,-7.267900,45.397700,-6.098500,-4.743800,45.397700,-8.216500,-1.647500,45.397700,-9.343400,1.647500,45.397700,-9.343400,4.743800,45.397700,-8.216500,7.267900,45.397700,-6.098500,8.915400,45.397700,-3.244900,8.915400,36.572400,3.244900,9.487500,36.572400,-0.000000,7.267900,36.572400,6.098500,4.743800,36.572400,8.216400,1.647500,36.572400,9.343400,-1.647500,36.572400,9.343400,-4.743800,36.572400,8.216400,-7.267900,36.572400,6.098500,-8.915400,36.572400,3.244900,-9.487500,36.572400,-0.000000,-8.915400,36.572400,-3.244900,-7.267900,36.572400,-6.098500,-4.743800,36.572400,-8.216500,-1.647500,36.572400,-9.343400,1.647500,36.572400,-9.343400,4.743800,36.572400,-8.216500,7.267900,36.572400,-6.098500,8.915400,36.572400,-3.244900,0.000000,36.572400,-0.000000],

	    "morphTargets": [],

	    "morphColors": [],

	    "normals": [0,1,0,0.8537,-0.5207,-0,0.8246,-0.5207,0.221,0.7393,-0.5207,0.4269,0.6037,-0.5207,0.6037,0.4269,-0.5207,0.7393,0.221,-0.5207,0.8246,0,-0.5207,0.8537,-0.221,-0.5207,0.8246,-0.4269,-0.5207,0.7393,-0.6037,-0.5207,0.6037,-0.7393,-0.5207,0.4269,-0.8246,-0.5207,0.221,-0.8537,-0.5207,0,-0.8246,-0.5207,-0.221,-0.7393,-0.5207,-0.4269,-0.6037,-0.5207,-0.6037,-0.4269,-0.5207,-0.7393,-0.221,-0.5207,-0.8246,-0,-0.5207,-0.8537,0.221,-0.5207,-0.8246,0.4269,-0.5207,-0.7393,0.6037,-0.5207,-0.6037,0.7393,-0.5207,-0.4269,0.8246,-0.5207,-0.221,0.8484,-0.5175,0.1117,0.8484,-0.5175,-0.1117,0.7906,-0.5175,0.3275,0.6789,-0.5175,0.5209,0.5209,-0.5175,0.6789,0.3275,-0.5175,0.7906,0.1117,-0.5175,0.8484,-0.1117,-0.5175,0.8484,-0.3275,-0.5175,0.7906,-0.5209,-0.5175,0.6789,-0.6789,-0.5175,0.5209,-0.7906,-0.5175,0.3275,-0.8484,-0.5175,0.1117,-0.8484,-0.5175,-0.1117,-0.7906,-0.5175,-0.3275,-0.6789,-0.5175,-0.5209,-0.5209,-0.5175,-0.6789,-0.3275,-0.5175,-0.7906,-0.1117,-0.5175,-0.8484,0.1117,-0.5175,-0.8484,0.3275,-0.5175,-0.7906,0.5209,-0.5175,-0.6789,0.6789,-0.5175,-0.5209,0.7906,-0.5175,-0.3275,1,0,-0,0.9397,-0,0.342,0.766,-0,0.6428,0.5,-0,0.866,0.1736,-0,0.9848,-0.1736,-0,0.9848,-0.5,-0,0.866,-0.766,-0,0.6428,-0.9397,-0,0.342,-1,-0,0,-0.9397,0,-0.342,-0.766,0,-0.6428,-0.5,0,-0.866,-0.1736,0,-0.9848,0.1736,0,-0.9848,0.5,0,-0.866,0.766,0,-0.6428,0.9397,0,-0.342,0,-1,-0],

	    "colors": [],

	    "uvs": [[0.5,1,0.8333,1,0.7917,1,0.75,1,0.9167,1,0.875,1,1,1,0.9583,1,0.0833,1,0.0417,1,-0,1,0.1667,1,0.125,1,0.25,1,0.2083,1,0.3333,1,0.2917,1,0.4167,1,0.375,1,0.5,1,0.4583,1,0.5833,1,0.5417,1,0.6667,1,0.625,1,0.7083,1,0.7917,0.8,0.75,0.8,0.8333,0.8,0.875,0.8,0.9167,0.8,0.9583,0.8,1,0.8,0.0417,0.8,-0,0.8,0.0833,0.8,0.125,0.8,0.1667,0.8,0.2083,0.8,0.25,0.8,0.2917,0.8,0.3333,0.8,0.375,0.8,0.4167,0.8,0.4583,0.8,0.5,0.8,0.5417,0.8,0.5833,0.8,0.625,0.8,0.6667,0.8,0.7083,0.8,0.7917,0.6,0.75,0.6,0.8333,0.6,0.875,0.6,0.9167,0.6,0.9583,0.6,1,0.6,0.0417,0.6,-0,0.6,0.0833,0.6,0.125,0.6,0.1667,0.6,0.2083,0.6,0.25,0.6,0.2917,0.6,0.3333,0.6,0.375,0.6,0.4167,0.6,0.4583,0.6,0.5,0.6,0.5417,0.6,0.5833,0.6,0.625,0.6,0.6667,0.6,0.7083,0.6,0.7917,0.4,0.75,0.4,0.8333,0.4,0.875,0.4,0.9167,0.4,0.9583,0.4,1,0.4,0.0417,0.4,0,0.4,0.0833,0.4,0.125,0.4,0.1667,0.4,0.2083,0.4,0.25,0.4,0.2917,0.4,0.3333,0.4,0.375,0.4,0.4167,0.4,0.4583,0.4,0.5,0.4,0.5417,0.4,0.5833,0.4,0.625,0.4,0.6667,0.4,0.7083,0.4,0.7917,0.2,0.75,0.2,0.8333,0.2,0.875,0.2,0.9167,0.2,0.9583,0.2,1,0.2,0.0417,0.2,0,0.2,0.0833,0.2,0.125,0.2,0.1667,0.2,0.2083,0.2,0.25,0.2,0.2917,0.2,0.3333,0.2,0.375,0.2,0.4167,0.2,0.4583,0.2,0.5,0.2,0.5417,0.2,0.5833,0.2,0.625,0.2,0.6667,0.2,0.7083,0.2,0.5,0,0.8611,1,0.8056,1,0.9722,1,0.0278,1,-0.0278,1,0.1944,1,0.1389,1,0.3056,1,0.3611,1,0.5278,1,0.4722,1,0.6389,1,0.6944,1,0.8056,0.8,0.75,0.8,0.8611,0.8,0.9167,0.8,0.9722,0.8,0.0278,0.8,-0.0278,0.8,0.0833,0.8,0.1389,0.8,0.1944,0.8,0.25,0.8,0.3056,0.8,0.3611,0.8,0.4167,0.8,0.4722,0.8,0.5278,0.8,0.5833,0.8,0.6389,0.8,0.6944,0.8,0.8056,0.6,0.75,0.6,0.8611,0.6,0.9167,0.6,0.9722,0.6,0.0278,0.6,-0.0278,0.6,0.0833,0.6,0.1389,0.6,0.1944,0.6,0.25,0.6,0.3056,0.6,0.3611,0.6,0.4167,0.6,0.4722,0.6,0.5278,0.6,0.5833,0.6,0.6389,0.6,0.6944,0.6,0.8056,0.4,0.75,0.4,0.8611,0.4,0.9167,0.4,0.9722,0.4,0.0278,0.4,-0.0278,0.4,0.0833,0.4,0.1389,0.4,0.1944,0.4,0.25,0.4,0.3056,0.4,0.3611,0.4,0.4167,0.4,0.4722,0.4,0.5278,0.4,0.5833,0.4,0.6389,0.4,0.6944,0.4,0.8056,0.2,0.75,0.2,0.8611,0.2,0.9167,0.2,0.9722,0.2,0.0278,0.2,-0.0278,0.2,0.0833,0.2,0.1389,0.2,0.1944,0.2,0.25,0.2,0.3056,0.2,0.3611,0.2,0.4167,0.2,0.4722,0.2,0.5278,0.2,0.5833,0.2,0.6389,0.2,0.6944,0.2,0.8056,0,0.75,0,0.8611,0,0.9167,0,0.9722,0,0.0278,0,-0.0278,0,0.0833,0,0.1389,0,0.1944,0,0.25,0,0.3056,0,0.3611,0,0.4167,0,0.4722,0,0.5278,0,0.5833,0,0.6389,0,0.6944,0,-0.0197,0]],

	    "faces": [43,0,1,2,3,0,0,1,2,3,0,0,0,0,43,0,4,5,1,0,0,4,5,1,0,0,0,0,43,0,6,7,4,0,0,6,7,4,0,0,0,0,43,0,8,9,6,0,0,8,9,10,0,0,0,0,43,0,10,11,8,0,0,11,12,8,0,0,0,0,43,0,12,13,10,0,0,13,14,11,0,0,0,0,43,0,14,15,12,0,0,15,16,13,0,0,0,0,43,0,16,17,14,0,0,17,18,15,0,0,0,0,43,0,18,19,16,0,0,19,20,17,0,0,0,0,43,0,20,21,18,0,0,21,22,19,0,0,0,0,43,0,22,23,20,0,0,23,24,21,0,0,0,0,43,0,3,24,22,0,0,3,25,23,0,0,0,0,43,3,2,25,26,0,3,2,26,27,1,2,2,1,43,2,1,27,25,0,2,1,28,26,2,3,3,2,43,1,5,28,27,0,1,5,29,28,3,4,4,3,43,5,4,29,28,0,5,4,30,29,4,5,5,4,43,4,7,30,29,0,4,7,31,30,5,6,6,5,43,7,6,31,30,0,7,6,32,31,6,7,7,6,43,6,9,32,31,0,10,9,33,34,7,8,8,7,43,9,8,33,32,0,9,8,35,33,8,9,9,8,43,8,11,34,33,0,8,12,36,35,9,10,10,9,43,11,10,35,34,0,12,11,37,36,10,11,11,10,43,10,13,36,35,0,11,14,38,37,11,12,12,11,43,13,12,37,36,0,14,13,39,38,12,13,13,12,43,12,15,38,37,0,13,16,40,39,13,14,14,13,43,15,14,39,38,0,16,15,41,40,14,15,15,14,43,14,17,40,39,0,15,18,42,41,15,16,16,15,43,17,16,41,40,0,18,17,43,42,16,17,17,16,43,16,19,42,41,0,17,20,44,43,17,18,18,17,43,19,18,43,42,0,20,19,45,44,18,19,19,18,43,18,21,44,43,0,19,22,46,45,19,20,20,19,43,21,20,45,44,0,22,21,47,46,20,21,21,20,43,20,23,46,45,0,21,24,48,47,21,22,22,21,43,23,22,47,46,0,24,23,49,48,22,23,23,22,43,22,24,48,47,0,23,25,50,49,23,24,24,23,43,24,3,26,48,0,25,3,27,50,24,1,1,24,43,26,25,49,50,0,27,26,51,52,1,2,2,1,43,25,27,51,49,0,26,28,53,51,2,3,3,2,43,27,28,52,51,0,28,29,54,53,3,4,4,3,43,28,29,53,52,0,29,30,55,54,4,5,5,4,43,29,30,54,53,0,30,31,56,55,5,6,6,5,43,30,31,55,54,0,31,32,57,56,6,7,7,6,43,31,32,56,55,0,34,33,58,59,7,8,8,7,43,32,33,57,56,0,33,35,60,58,8,9,9,8,43,33,34,58,57,0,35,36,61,60,9,10,10,9,43,34,35,59,58,0,36,37,62,61,10,11,11,10,43,35,36,60,59,0,37,38,63,62,11,12,12,11,43,36,37,61,60,0,38,39,64,63,12,13,13,12,43,37,38,62,61,0,39,40,65,64,13,14,14,13,43,38,39,63,62,0,40,41,66,65,14,15,15,14,43,39,40,64,63,0,41,42,67,66,15,16,16,15,43,40,41,65,64,0,42,43,68,67,16,17,17,16,43,41,42,66,65,0,43,44,69,68,17,18,18,17,43,42,43,67,66,0,44,45,70,69,18,19,19,18,43,43,44,68,67,0,45,46,71,70,19,20,20,19,43,44,45,69,68,0,46,47,72,71,20,21,21,20,43,45,46,70,69,0,47,48,73,72,21,22,22,21,43,46,47,71,70,0,48,49,74,73,22,23,23,22,43,47,48,72,71,0,49,50,75,74,23,24,24,23,43,48,26,50,72,0,50,27,52,75,24,1,1,24,43,50,49,73,74,0,52,51,76,77,1,2,2,1,43,49,51,75,73,0,51,53,78,76,2,3,3,2,43,51,52,76,75,0,53,54,79,78,3,4,4,3,43,52,53,77,76,0,54,55,80,79,4,5,5,4,43,53,54,78,77,0,55,56,81,80,5,6,6,5,43,54,55,79,78,0,56,57,82,81,6,7,7,6,43,55,56,80,79,0,59,58,83,84,7,8,8,7,43,56,57,81,80,0,58,60,85,83,8,9,9,8,43,57,58,82,81,0,60,61,86,85,9,10,10,9,43,58,59,83,82,0,61,62,87,86,10,11,11,10,43,59,60,84,83,0,62,63,88,87,11,12,12,11,43,60,61,85,84,0,63,64,89,88,12,13,13,12,43,61,62,86,85,0,64,65,90,89,13,14,14,13,43,62,63,87,86,0,65,66,91,90,14,15,15,14,43,63,64,88,87,0,66,67,92,91,15,16,16,15,43,64,65,89,88,0,67,68,93,92,16,17,17,16,43,65,66,90,89,0,68,69,94,93,17,18,18,17,43,66,67,91,90,0,69,70,95,94,18,19,19,18,43,67,68,92,91,0,70,71,96,95,19,20,20,19,43,68,69,93,92,0,71,72,97,96,20,21,21,20,43,69,70,94,93,0,72,73,98,97,21,22,22,21,43,70,71,95,94,0,73,74,99,98,22,23,23,22,43,71,72,96,95,0,74,75,100,99,23,24,24,23,43,72,50,74,96,0,75,52,77,100,24,1,1,24,43,74,73,97,98,0,77,76,101,102,1,2,2,1,43,73,75,99,97,0,76,78,103,101,2,3,3,2,43,75,76,100,99,0,78,79,104,103,3,4,4,3,43,76,77,101,100,0,79,80,105,104,4,5,5,4,43,77,78,102,101,0,80,81,106,105,5,6,6,5,43,78,79,103,102,0,81,82,107,106,6,7,7,6,43,79,80,104,103,0,84,83,108,109,7,8,8,7,43,80,81,105,104,0,83,85,110,108,8,9,9,8,43,81,82,106,105,0,85,86,111,110,9,10,10,9,43,82,83,107,106,0,86,87,112,111,10,11,11,10,43,83,84,108,107,0,87,88,113,112,11,12,12,11,43,84,85,109,108,0,88,89,114,113,12,13,13,12,43,85,86,110,109,0,89,90,115,114,13,14,14,13,43,86,87,111,110,0,90,91,116,115,14,15,15,14,43,87,88,112,111,0,91,92,117,116,15,16,16,15,43,88,89,113,112,0,92,93,118,117,16,17,17,16,43,89,90,114,113,0,93,94,119,118,17,18,18,17,43,90,91,115,114,0,94,95,120,119,18,19,19,18,43,91,92,116,115,0,95,96,121,120,19,20,20,19,43,92,93,117,116,0,96,97,122,121,20,21,21,20,43,93,94,118,117,0,97,98,123,122,21,22,22,21,43,94,95,119,118,0,98,99,124,123,22,23,23,22,43,95,96,120,119,0,99,100,125,124,23,24,24,23,43,96,74,98,120,0,100,77,102,125,24,1,1,24,43,98,97,121,121,0,102,101,126,126,1,2,25,26,43,97,99,121,121,0,101,103,126,126,2,3,27,25,43,99,100,121,121,0,103,104,126,126,3,4,28,27,43,100,101,121,121,0,104,105,126,126,4,5,29,28,43,101,102,121,121,0,105,106,126,126,5,6,30,29,43,102,103,121,121,0,106,107,126,126,6,7,31,30,43,103,104,121,121,0,109,108,126,126,7,8,32,31,43,104,105,121,121,0,108,110,126,126,8,9,33,32,43,105,106,121,121,0,110,111,126,126,9,10,34,33,43,106,107,121,121,0,111,112,126,126,10,11,35,34,43,107,108,121,121,0,112,113,126,126,11,12,36,35,43,108,109,121,121,0,113,114,126,126,12,13,37,36,43,109,110,121,121,0,114,115,126,126,13,14,38,37,43,110,111,121,121,0,115,116,126,126,14,15,39,38,43,111,112,121,121,0,116,117,126,126,15,16,40,39,43,112,113,121,121,0,117,118,126,126,16,17,41,40,43,113,114,121,121,0,118,119,126,126,17,18,42,41,43,114,115,121,121,0,119,120,126,126,18,19,43,42,43,115,116,121,121,0,120,121,126,126,19,20,44,43,43,116,117,121,121,0,121,122,126,126,20,21,45,44,43,117,118,121,121,0,122,123,126,126,21,22,46,45,43,118,119,121,121,0,123,124,126,126,22,23,47,46,43,119,120,121,121,0,124,125,126,126,23,24,48,47,43,120,98,121,121,0,125,102,126,126,24,1,26,48,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,121,121,121,121,0,126,126,126,126,49,49,49,49,43,122,123,124,125,0,0,127,128,3,0,0,0,0,43,122,126,127,123,0,0,129,4,127,0,0,0,0,43,122,128,129,126,0,0,8,130,131,0,0,0,0,43,122,130,131,128,0,0,132,133,8,0,0,0,0,43,122,132,133,130,0,0,134,13,132,0,0,0,0,43,122,134,135,132,0,0,17,135,134,0,0,0,0,43,122,136,137,134,0,0,136,137,17,0,0,0,0,43,122,138,139,136,0,0,138,21,136,0,0,0,0,43,122,125,140,138,0,0,3,139,138,0,0,0,0,43,125,124,141,142,0,3,128,140,141,49,50,50,49,43,124,123,143,141,0,128,127,142,140,50,51,51,50,43,123,127,144,143,0,127,4,143,142,51,52,52,51,43,127,126,145,144,0,4,129,144,143,52,53,53,52,43,126,129,146,145,0,131,130,145,146,53,54,54,53,43,129,128,147,146,0,130,8,147,145,54,55,55,54,43,128,131,148,147,0,8,133,148,147,55,56,56,55,43,131,130,149,148,0,133,132,149,148,56,57,57,56,43,130,133,150,149,0,132,13,150,149,57,58,58,57,43,133,132,151,150,0,13,134,151,150,58,59,59,58,43,132,135,152,151,0,134,135,152,151,59,60,60,59,43,135,134,153,152,0,135,17,153,152,60,61,61,60,43,134,137,154,153,0,17,137,154,153,61,62,62,61,43,137,136,155,154,0,137,136,155,154,62,63,63,62,43,136,139,156,155,0,136,21,156,155,63,64,64,63,43,139,138,157,156,0,21,138,157,156,64,65,65,64,43,138,140,158,157,0,138,139,158,157,65,66,66,65,43,140,125,142,158,0,139,3,141,158,66,49,49,66,43,142,141,159,160,0,141,140,159,160,49,50,50,49,43,141,143,161,159,0,140,142,161,159,50,51,51,50,43,143,144,162,161,0,142,143,162,161,51,52,52,51,43,144,145,163,162,0,143,144,163,162,52,53,53,52,43,145,146,164,163,0,146,145,164,165,53,54,54,53,43,146,147,165,164,0,145,147,166,164,54,55,55,54,43,147,148,166,165,0,147,148,167,166,55,56,56,55,43,148,149,167,166,0,148,149,168,167,56,57,57,56,43,149,150,168,167,0,149,150,169,168,57,58,58,57,43,150,151,169,168,0,150,151,170,169,58,59,59,58,43,151,152,170,169,0,151,152,171,170,59,60,60,59,43,152,153,171,170,0,152,153,172,171,60,61,61,60,43,153,154,172,171,0,153,154,173,172,61,62,62,61,43,154,155,173,172,0,154,155,174,173,62,63,63,62,43,155,156,174,173,0,155,156,175,174,63,64,64,63,43,156,157,175,174,0,156,157,176,175,64,65,65,64,43,157,158,176,175,0,157,158,177,176,65,66,66,65,43,158,142,160,176,0,158,141,160,177,66,49,49,66,43,160,159,177,178,0,160,159,178,179,49,50,50,49,43,159,161,179,177,0,159,161,180,178,50,51,51,50,43,161,162,180,179,0,161,162,181,180,51,52,52,51,43,162,163,181,180,0,162,163,182,181,52,53,53,52,43,163,164,182,181,0,165,164,183,184,53,54,54,53,43,164,165,183,182,0,164,166,185,183,54,55,55,54,43,165,166,184,183,0,166,167,186,185,55,56,56,55,43,166,167,185,184,0,167,168,187,186,56,57,57,56,43,167,168,186,185,0,168,169,188,187,57,58,58,57,43,168,169,187,186,0,169,170,189,188,58,59,59,58,43,169,170,188,187,0,170,171,190,189,59,60,60,59,43,170,171,189,188,0,171,172,191,190,60,61,61,60,43,171,172,190,189,0,172,173,192,191,61,62,62,61,43,172,173,191,190,0,173,174,193,192,62,63,63,62,43,173,174,192,191,0,174,175,194,193,63,64,64,63,43,174,175,193,192,0,175,176,195,194,64,65,65,64,43,175,176,194,193,0,176,177,196,195,65,66,66,65,43,176,160,178,194,0,177,160,179,196,66,49,49,66,43,178,177,195,196,0,179,178,197,198,49,50,50,49,43,177,179,197,195,0,178,180,199,197,50,51,51,50,43,179,180,198,197,0,180,181,200,199,51,52,52,51,43,180,181,199,198,0,181,182,201,200,52,53,53,52,43,181,182,200,199,0,184,183,202,203,53,54,54,53,43,182,183,201,200,0,183,185,204,202,54,55,55,54,43,183,184,202,201,0,185,186,205,204,55,56,56,55,43,184,185,203,202,0,186,187,206,205,56,57,57,56,43,185,186,204,203,0,187,188,207,206,57,58,58,57,43,186,187,205,204,0,188,189,208,207,58,59,59,58,43,187,188,206,205,0,189,190,209,208,59,60,60,59,43,188,189,207,206,0,190,191,210,209,60,61,61,60,43,189,190,208,207,0,191,192,211,210,61,62,62,61,43,190,191,209,208,0,192,193,212,211,62,63,63,62,43,191,192,210,209,0,193,194,213,212,63,64,64,63,43,192,193,211,210,0,194,195,214,213,64,65,65,64,43,193,194,212,211,0,195,196,215,214,65,66,66,65,43,194,178,196,212,0,196,179,198,215,66,49,49,66,43,196,195,213,214,0,198,197,216,217,49,50,50,49,43,195,197,215,213,0,197,199,218,216,50,51,51,50,43,197,198,216,215,0,199,200,219,218,51,52,52,51,43,198,199,217,216,0,200,201,220,219,52,53,53,52,43,199,200,218,217,0,203,202,221,222,53,54,54,53,43,200,201,219,218,0,202,204,223,221,54,55,55,54,43,201,202,220,219,0,204,205,224,223,55,56,56,55,43,202,203,221,220,0,205,206,225,224,56,57,57,56,43,203,204,222,221,0,206,207,226,225,57,58,58,57,43,204,205,223,222,0,207,208,227,226,58,59,59,58,43,205,206,224,223,0,208,209,228,227,59,60,60,59,43,206,207,225,224,0,209,210,229,228,60,61,61,60,43,207,208,226,225,0,210,211,230,229,61,62,62,61,43,208,209,227,226,0,211,212,231,230,62,63,63,62,43,209,210,228,227,0,212,213,232,231,63,64,64,63,43,210,211,229,228,0,213,214,233,232,64,65,65,64,43,211,212,230,229,0,214,215,234,233,65,66,66,65,43,212,196,214,230,0,215,198,217,234,66,49,49,66,43,231,230,214,213,0,126,234,217,216,67,67,67,67,43,231,213,215,216,0,126,216,218,219,67,67,67,67,43,231,216,217,218,0,126,235,222,221,67,67,67,67,43,231,218,219,220,0,126,221,223,224,67,67,67,67,43,231,220,221,222,0,126,224,225,226,67,67,67,67,43,231,222,223,224,0,126,226,227,228,67,67,67,67,43,231,224,225,226,0,126,228,229,230,67,67,67,67,43,231,226,227,228,0,126,230,231,232,67,67,67,67,43,231,228,229,230,0,126,232,233,234,67,67,67,67],

	    "edges" : []
};




